package com.mrx.spring.example.runner;

import com.mrx.commons.mail.MailHelper;
import com.mrx.commons.mail.model.MailDTO;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author Mr.X
 * @since 2024-01-12 11:30
 **/
@Component
public class MailRunner implements ApplicationRunner {

    @Resource
    private MailHelper mailHelper;

    @Override
    @Async("traceExecutor")
    public void run(ApplicationArguments args) {
        mailHelper.sendSimpleMail(MailDTO.builder().build());
    }

}
